<?php
session_start();
require './static/php/init.php';
require './static/php/function.php';
$username = $_POST['username'];
$password = $_POST['password'];
$sql = 'select `username`,`password` from `user`';
if(!$res = mysqli_query($link,$sql)){
    exit("SQL[$sql]执行失败：" . mysqli_error($link));
}
$data = mysqli_fetch_all($res,MYSQLI_ASSOC);
mysqli_free_result($res);
mysqli_close($link);
if ($data[0]['username']==$username&&$data[0]['password']==$password){
    $_SESSION["name"]="a";
        header("Location:index.php");

}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>首页</title>
    <link rel="stylesheet" href="static/css/root.css">
    <link rel="stylesheet" href="static/css/aside.css">
    <link rel="stylesheet" href="static/css/index.css">
    <link rel="stylesheet" href="static/css/bannershow.css">
</head>
<body>

    <div class="box">
        <!-- 主体 -->
        <div class="leftbox">
            <!-- 开场轮播图 -->
            <div class="banner">
               <div id="banner_box"></div>
            </div>
        </div>
        <!-- 导航栏 -->
        <aside class="rightbox">
            <form action="<?php print $_SERVER['PHP_SELF']?>" method="post">
            <div class="navbar">
                    <li class="aside-item">
                        <a  class="aside-item-link"><span><img src="static/img/about.png" alt=""></span></a>
                    </li>
                <li class="aside-item">
                    <p class="aside-item-link">账号</p>
                </li>
                <li class="aside-item">
                 <input type="text" name="username">
                </li>
                <li class="aside-item">
                    <p class="aside-item-link">密码</p>  <br>
                </li>
                <li class="aside-item">
                    <input type="password" name="password">
                </li>
                <li class="aside-item">
                    <input type="submit" value="登陆">
                </li>
                </ul>
                <li class="aside-item">-->
                    <a href="pages/about.php" class="aside-item-link"><span><img src="static/img/like.png" alt=""></span>留言板</a>
                </li>
                <!--                  <li class="aside-item">-->
                <!--                       <a href="./pages/about.php" class="aside-item-link"><span><img src="./static/img/about.png" alt=""></span>关于</a>-->
                <!--                 </li>-->
                <li class="aside-item">
                    <a href="pages/message.html" class="aside-item-link"><span><img src="static/img/tip.png" alt=""></span>留言</a>
                </li>
            </div>
            </form>
        </aside>
    </div>

    <!-- js -->
<!--    <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.3.1/gsap.min.js"></script>-->
<!--    <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.3.1/ScrollTrigger.min.js"></script>-->
<!--    <script src="./static/js/index.js"></script>-->
    <script src="static/js/bannershow.js"></script>

</body>
</html>